package statickeyword;

/**
 * @License: (C) Copyright 2013-2022
 * @Contact: abcque@outlook.com
 * @IDE: IntelliJ IDEA
 * @Encoding: utf-8
 * @Project: st2214st2215
 * @Package: statickeyword
 * @File: Singleton.java
 * @Time: 2023/3/21 14:48
 * @Author: abcque
 * @Description: 单例模式——饿汉式
 * @Modifier:
 * @ModifyDate:
 * @ModifyRemark:
 */
public class SingletonHungry {
    private SingletonHungry(){
        System.out.println("调用了构造器");
    }

    // 尽早的创建对象
    private static SingletonHungry singleton = new SingletonHungry();

    public static SingletonHungry getInstance(){
        return singleton;
    }
}
